<?php

class ShopfunctionsController extends AppController {
    var $name = 'Shopfunctions';
    var $helpers = array('Html','Ajax','Javascript','Form');

	function index($id=null){
    	$this->layout = "home";
		$data = $this->Shopfunction->find('all');
        $this->set("data",$data);
	}
	function form($id=null){
		$this->layout="home";	
	}//ô
	function add(){
		if(empty($id)){
			$name = $_REQUEST['name'];
			$description = $_REQUEST['description'];
	
			$this->Shopfunction->create();
			$this->Shopfunction->set('Name', $name);
			$this->Shopfunction->set('Description', $description);
			$this->Shopfunction->saveAll();
		}
        $this->redirect(array("action" => "index", $this->Shopfunction->id));
	}
	function edit(){
		if(!empty($id)){
			$id = $_REQUEST['id'];
			$name = $_REQUEST['name'];
			$description = $_REQUEST['description'];
			
			$this->Shopfunction->id=$id;
			$this->Shopfunction->set('Name', $name);
			$this->Shopfunction->set('Description', $description);
			$this->Shopfunction->saveAll();
		}
        $this->redirect(array("action" => "index", $this->Shopfunction->id));
	}
	function delete(){
		
	}
}
?>